<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8" />
    <title>{{ADMINNAME}}-{{$title}}</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
    <meta name="csrf-token" content="{{ csrf_token() }}">
    @include('adminer.public.style')

</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body id="login-body">
<div class="login-header">
    <!-- BEGIN LOGO -->
    {{--<div id="logo" class="center">--}}
        {{--<img src="/img/logo.png" alt="logo" class="center" />--}}
    {{--</div>--}}
    <!-- END LOGO -->
</div>

<!-- BEGIN LOGIN -->
<div id="login">
    <!-- BEGIN LOGIN FORM -->
    <form id="main-form" class="form-vertical no-padding no-margin" method="post" action="/manage/login">
        <div class="lock">
            <i class="icon-lock"></i>
        </div>
        <div class="control-wrap">
            <h4>用户登录</h4>
            <div class="control-group">
                <div class="controls">
                    <div class="input-prepend">
                        <span class="add-on"><i class="icon-user"></i></span><input id="input-username" type="text" placeholder="Username" name="username" />
                    </div>
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <div class="input-prepend">
                        <span class="add-on"><i class="icon-key"></i></span><input id="input-password" type="password" placeholder="Password" name="password" />
                    </div>
                    <div class="mtop10">
                        <div class="block-hint pull-left small">
                            <input type="checkbox" id=""> 记住我
                        </div>
                        <div class="block-hint pull-right" id="error">
                            <span id="error-tip" style="color:#f4645f"></span>
                        </div>
                    </div>

                    <div class="clearfix space5"></div>
                </div>

            </div>
        </div>

        <input type="submit" id="login-btn" class="btn btn-block login-btn" value="点击登录" />
    </form>
    <!-- END LOGIN FORM -->
</div>
<!-- END LOGIN -->
<!-- BEGIN COPYRIGHT -->
<div id="login-copyright">
    {{date('Y')}} &copy; {{ADMINNAME}}
</div>
<!-- END COPYRIGHT -->
<!-- BEGIN JAVASCRIPTS -->
@include("adminer.public.js")
<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    $(function() {
        if($("#main-form").length > 0){
            $("#main-form").Validform({
                btnReset:".btn_reset",
                ajaxPost: true,
                showAllError: false,
                tipSweep: true,
                callback: function (ret) {
                    if(ret.hasOwnProperty('code')){
                        /* 表单验证错误 */
                        if(ret.code == 200){

                            if(ret.hasOwnProperty('redirect') && ret.redirect != 'parent'){

                                layer.msg(ret.message,{time:1500}, function(){
                                    window.location.href = ret.redirect;
                                });

                            }else{
                                layer.msg(ret.message,{time:1500}, function(){
                                    window.location.href = document.referrer;;
                                });
                            }
                            return false;
                        }else{
                            $('#error-tip').html(ret.message);
                            $('#error').show();
                            return false;
                        }

                    }else{
                        $('#error-tip').html('网络请求失败');
                        $('#error').show();
                    }
                    return false;
                },
                tiptype:function(msg,o,cssctl){

                    if(o.type == 3){
                        $('#error-tip').html(msg);
                        $('#error').show();
                    }else{
                        $('#error-tip').html('');
                        $('#error').hide();
                    }
                }
            });
        }

    });

</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>